//
//  UIFactory.swift
//  01-新浪微博
//
//  Created by 陈许亚 on 16/3/14.
//  Copyright © 2016年 cxy. All rights reserved.
//

import UIKit
//抽象类工厂    只是一个抽象接口，具体的实现是由具体的类来实现的
//所有的UI控件都可以用这个类来实例化
//抽象类
class  UIFactory {
    //抽象方法
    class func labelFactory(text: String,textColor: UIColor,fontSize: CGFloat,alignment: NSTextAlignment = .Center) -> UILabel {
        
        let l = UILabel.labelWith(text, textColor: textColor, fontSize: fontSize,alignment: alignment)
        
        return l
    }
    
    //抽象方法 背景图片+图片样式的按钮
    class func buttonWithImage(imageName: String?,backImageName: String?) -> UIButton {
        
        let btn = UIButton.buttonWithImage(imageName, backImageName: backImageName)
        
        return btn
    }
    
    //抽象方法 背景图片+标题 + 图片样式的按钮
    class func buttonWithTitle(backImageName: String?,title: String,titleColor: UIColor,fontSizeOfTitle: CGFloat,imageName: String? = nil) -> UIButton {
        
        let btn = UIButton.buttonWithTitle(backImageName, title: title, titleColor: titleColor, fontSizeOfTitle: fontSizeOfTitle,imageName: imageName)
        
        return btn
        
    }


    
}
